package com.zsh.archer.web.sys;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zsh.CommonResponse;
import com.zsh.archer.model.po.sys.Accounts;
import com.zsh.archer.service.sys.IAccountsService;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zsh
 * @since 2020-07-28
 */
@RestController
@RequestMapping("/sys/accounts")
public class AccountsController {

    private final IAccountsService iAccountsService;

    public AccountsController(IAccountsService iAccountsService) {
        this.iAccountsService = iAccountsService;
    }

    @RequestMapping(value = "findAll", method = RequestMethod.GET)
    @ResponseBody
    public CommonResponse listAll() {
        return CommonResponse.success(iAccountsService.list());
    }

    @RequestMapping(value = "findByCondition", method = RequestMethod.GET)
    @ResponseBody
    public CommonResponse findByCondition(Accounts req) {
        return CommonResponse.success(iAccountsService.list(Wrappers.<Accounts>lambdaQuery().
                eq(Accounts::getHost, "zsh")));
    }
}

